//
//  UPUserDefaults.h
//  Uang Pasti
//
//  Created by 李永彬 on 2025/8/16.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

extern NSString *const loginSessionIdKey;
extern NSString *const loginPhoneNumberKey;
extern NSString *const environmentCountryKey;
extern NSString *const myAddressKey;
extern NSString *const loginStartTimeKey;
extern NSString *const loginEndTimeKey;
extern NSString *const loginReportGoogleMarketKey;
extern NSString *const homeReportGoogleMarketKey;

@interface UPUserDefaults : NSObject

#pragma mark - 基础方法
+ (void)setObject:(id)object forKey:(NSString *)key;
+ (id)objectForKey:(NSString *)key;
+ (void)removeObjectForKey:(NSString *)key;
+ (BOOL)hasValueForKey:(NSString *)key;

#pragma mark - 类型安全方法
// Bool
+ (void)setBool:(BOOL)value forKey:(NSString *)key;
+ (BOOL)boolForKey:(NSString *)key defaultValue:(BOOL)defaultValue;
+ (BOOL)boolForKey:(NSString *)key;

// Integer
+ (void)setInteger:(NSInteger)value forKey:(NSString *)key;
+ (NSInteger)integerForKey:(NSString *)key defaultValue:(NSInteger)defaultValue;
+ (NSInteger)integerForKey:(NSString *)key;

// Float
+ (void)setFloat:(float)value forKey:(NSString *)key;
+ (float)floatForKey:(NSString *)key defaultValue:(float)defaultValue;
+ (float)floatForKey:(NSString *)key;

// Double
+ (void)setDouble:(double)value forKey:(NSString *)key;
+ (double)doubleForKey:(NSString *)key defaultValue:(double)defaultValue;
+ (double)doubleForKey:(NSString *)key;

// String
+ (void)setString:(NSString *)value forKey:(NSString *)key;
+ (NSString *)stringForKey:(NSString *)key defaultValue:(NSString *)defaultValue;
+ (NSString *)stringForKey:(NSString *)key;

// URL
+ (void)setURL:(NSURL *)url forKey:(NSString *)key;
+ (NSURL *)URLForKey:(NSString *)key defaultValue:(NSURL *)defaultValue;
+ (NSURL *)URLForKey:(NSString *)key;

#pragma mark - 便捷方法
+ (void)clearAllData;
+ (void)synchronize;

@end

NS_ASSUME_NONNULL_END
